package com.yanqu.road.server.cmd.union.cross.huaben;

import com.yanqu.road.entity.union.huaben.UnionHuaBenMemberWeekData;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.union.cross.UnionHuaBenProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.union.huaben.CrossUnionHuaBenMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_UNION_HUA_BEN_SETTLE_MAIL_BACK, desc = "话本结算额外奖励分发反馈")
public class CrossUnionHuaBenSettleMailScoreBackCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {


        UnionHuaBenProto.UnionHuaBenSettleMailScoreBackMsg backMsg = UnionHuaBenProto.UnionHuaBenSettleMailScoreBackMsg.parseFrom(packet.getBytes());

        for (long userId : backMsg.getUserIdList()) {
            UnionHuaBenMemberWeekData weekData = CrossUnionHuaBenMgr.getUnionHuaBenMemberWeekData(backMsg.getWeekId(), serverId, userId);
            if(weekData != null){
                weekData.setSettleSync(true);
            }
        }

    }

    @Override
    public void sendData() {

    }
}
